/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package za.co.pas.business.model.ext;

import java.beans.PropertyChangeListener;
import java.util.List;
import org.apache.log4j.Logger;
import za.co.pas.business.abstracts.AbstractDataModel;
import za.co.pas.business.data.UserGroups;
import za.co.pas.business.data.UserLoginDetails;
import za.co.pas.business.data.UserType;
import za.co.pas.business.model.UserDataModel;

/**
 *
 * @author alabuschagne
 */
public class UserDetailModel  extends AbstractDataModel
{
    private UserLoginDetails currentUser;
    private UserDataModel userDataModel = new UserDataModel();
    private static Logger logger = Logger.getLogger(UserDetailModel.class);    

    /**
     * @return the userDataModel
     */
    public UserDataModel getUserDataModel()
    {
        return userDataModel;
    }

    /**
     * @param userDataModel the userDataModel to set
     */
    public void setUserDataModel(UserDataModel userDataModel)
    {
        this.userDataModel = userDataModel;
    }

    /**
     * @return the currentUser
     */
    public UserLoginDetails getCurrentUser()
    {
        return currentUser;
    }

    /**
     * @param currentUser the currentUser to set
     */
    public void setCurrentUser(UserLoginDetails currentUser)
    {
        this.currentUser = currentUser;
    }

    @Override
    public void addPropertyChangeListener(PropertyChangeListener listener)
    {
        propertyChangeSupport.addPropertyChangeListener(listener);
        userDataModel.addPropertyChangeListener(listener);
    }

    @Override
    public void removePropertyChangeListener(PropertyChangeListener listener)
    {
        propertyChangeSupport.removePropertyChangeListener(listener);
        userDataModel.removePropertyChangeListener(listener);
    }

    public UserType getUserType(String string)
    {
        return userDataModel.getUserType(string);
    }

    public UserGroups getUserGroup(String string)
    {
        return userDataModel.getUserGroup(string);
    }

    public void addUserLoginDetails(UserLoginDetails uld)
    {
        userDataModel.addUserLoginDetails(uld);
    }

    public UserLoginDetails getUserLoginDetails(String username, String password)
    {
        return userDataModel.getUserLoginDetails(username, password);
    }

    public boolean checkDB()
    {
        return userDataModel.checkDB();
    }

    public List<UserGroups> getUserGroups(boolean force)
    {
        return userDataModel.getUserGroups(force);
    }

    public List<UserType> getUserTypes(boolean force)
    {
        return userDataModel.getUserTypes(force);
    }

    public void addUserGroups(UserGroups ug)
    {
        userDataModel.addUserGroups(ug);
    }


}
